#include<iostream>
#include<memory>
#include"ThreadPool.hpp"
#include"Task.hpp"
#include"Log.hpp"

int main()
{
    // Log log;
    // log.Enable(OneFile);

    // log.LogMessage(Debug, "hello %d world %lf\n", 10, 3.14);
    // log.LogMessage(Error, "hello %d world %lf\n", 10, 3.14);
    // log.LogMessage(Warning, "hello %d world %lf\n", 10, 3.14);
    // log.LogMessage(Info, "hello %d world %lf\n", 10, 3.14);
    // log.LogMessage(Fatal, "hello %d world %lf\n", 10, 3.14);
    // log.LogMessage(Debug, "hello %d world %lf\n", 10, 3.14);
    // log.LogMessage(Debug, "hello %d world %lf\n", 10, 3.14);

    // std::unique_ptr<ThreadPool<Task>> tp(new ThreadPool<Task>());
    // tp->Start();
    ThreadPool<Task>::GetInstance()->Start();

    srand((uint64_t)time(nullptr) ^ getpid());

    while(true)
    {
        int x = rand() % 100 + 1;
        usleep(1234);
        int y = rand() % 200;
        usleep(1234);
        char oper = opers[rand() % opers.size()];

        Task t(x, y, oper);
        ThreadPool<Task>::GetInstance()->Push(t);

        sleep(1);
    }

    ThreadPool<Task>::GetInstance()->Wait();

    return 0;
}